﻿using System;
using System.Windows.Forms;
using DevExpress.MailClient.Win.Forms;
using DevExpress.MailClient.Win.Forms.Data;
using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Views.Base;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraGrid.Views.Layout.ViewInfo;

namespace DevExpress.MailClient.Win.Modules {
    public partial class Donnees : BaseModule {
        public override string ModuleName { get { return Properties.Resources.ContactsName; } }
        public Donnees() {
            InitializeComponent();
            EditorHelper.InitPersonComboBox(repositoryItemImageComboBox1);
            gridControl1.DataSource = DataHelper.Contacts;
            gridView1.ShowFindPanel();
        }
        protected override DevExpress.XtraGrid.GridControl Grid { get { return gridControl1; } }
        internal override void ShowModule(bool firstShow) {
            base.ShowModule(firstShow);
            gridControl1.Focus();
         
            if(firstShow) {
                gridControl1.ForceInitialize();
                GridHelper.SetFindControlImages(gridControl1);
                //if(DataHelper.Contacts.Count == 0) UpdateCurrentContact();
            }
        }
      
        protected internal override void ButtonClick(string tag) {
            switch(tag) {
                case TagResources.ChargerDonnees:
                    UploadData();
                    break;

            }
        }

        private void UploadData()
        {
            var formCharger = new frmUploadData();
            var result=formCharger.ShowDialog();
        }
    }
}
